package com.repair.auth.pojo.vo;

import com.repair.api.user.response.data.UserInfo;
import com.repair.satoken.utils.StpKit;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @author chunyu
 * @since 2024/9/21,19:25 <br>
 * <a href="https://sa-token.cc/doc.html#/up/not-cookie">小程序cookie解决办法</a> <br>
 * 小程序没有cookie所以 要返回token
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LoginVO implements Serializable {

    private static final long serialVersionUID = 1L;

    private Long id;

    private String token;

    private Long tokenExpiration;

    public LoginVO(UserInfo userInfo) {
        this.id = userInfo.getId();
        this.token = StpKit.USER.getTokenValue();
        this.tokenExpiration = StpKit.USER.getTokenActiveTimeout();
    }
}
